local cjson = require "cjson"; 
local category = model.__new( _CONF["mysql"] , "mysql"); 
category.table = 'mg_arctype';

--初始化动作
function category:getone() 
     return {43,"haha",00, "nihao "};
end  

--[[
- @desc   获取多条文章
- @param  table where   字符串
- @param  string limit   字符串
- return  table
--]]
function category:getall()
    local cache = model.__get("cache");
    local res, err, errno, sqlstate = cache:get('category__result__key');  --缓存
       
    if  (type(res) == "userdata") or res == nil then  -- type类型
         local sql = 'SELECT * FROM  ' .. self.table .. ' where `show`=1';    
         res, err, errno, sqlstate = self.mysql(sql);   
         cache:set('category__result__key',  tostring(cjson.encode(res)));  
      
     else    
         res = cjson.decode(tostring(res));  
     end   
  
     return res;
end 

return category;
